unit PlanoContaDM;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ZDataset, ZSqlUpdate, ZSequence, MainDM, QueryConditions, db;

type

  { TPlanoContaData }

  TPlanoContaData = class(TMainDataModule)
    PlanoContaDatasource: TDatasource;
    PlanoContaZQuerydesc_plano_conta: TStringField;
    PlanoContaZQueryid_centro_custo: TLargeintField;
    PlanoContaZQueryid_plano_conta: TLargeintField;
    PlanoContaZQueryparent_id_plano_conta: TLargeintField;
    PlanoContaZQuerytipo: TStringField;
    PlanoContaZSequence: TZSequence;
    PlanoContaZUpdate: TZUpdateSQL;
    PlanoContaZQuery: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  PlanoContaData: TPlanoContaData;

implementation

uses ConnectionDM;

{ TPlanoContaData }


procedure TPlanoContaData.DataModuleCreate(Sender: TObject);
begin
   MainDataSet := PlanoContaZQuery;
   PlanoContaZQuery.Open;
end;
procedure TPlanoContaData.OpenDataSet;
begin
  //ConnectionData.EmptyQuery(PlanoContaZQuery, 'plano_conta');
end;

procedure TPlanoContaData.CloseDataSet;
begin
  //PlanoContaZQuery.Close();
end;

procedure TPlanoContaData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
    ConnectionData.OpenQueryConditions(PlanoContaZQuery, Tabela, Condicoes);
end;

initialization
  {$I planocontadm.lrs}

end.

